﻿using System;
using System.Collections.Generic;
using System.Data;
using Module.Common.Models;
using Module.Core.DAO;
using Module.Core.EntitiesInfo.TablesInfo;

namespace Module.Core.BusinessLogic
{
    public class CityBL
	{



        /// <summary>
        /// Delete a record from the City table.
        /// </summary>
        public static void Delete(int cityId)
        {
            try
            {
                new CityDAO().Delete(cityId);
            }
            catch (Exception ex)
            {
                throw;
            }

        }

        /// <summary>
        /// Lấy tổng số bản ghi
        /// </summary>        
        /// <param name="isTotalRow">=True lấy tổng sổ bản ghi</param>
        /// <returns></returns>
        public static int SelectCount(string cityName,bool isTotalRow)
        {
            try
            {
                return new CityDAO().SelectCount(cityName,isTotalRow);
            }
            catch (Exception ex)
            {
                throw;
            }

        }

        public static DataTable Search(string cityName, int beginRow, int endRow, string orderByColumn, bool isTotalRow)
        {
            try
            {
                return new CityDAO().Search(cityName,beginRow, endRow, orderByColumn, isTotalRow);
            }
            catch (Exception ex)
            {
                throw;
            }

        }

        /// <summary>
        /// Selects a single record from the City table.
        /// </summary>
        public static CityInfo Select(int cityId)
        {
            try
            {
                return new CityDAO().Select(cityId);
            }
            catch (Exception ex)
            {
                throw;
            }

        }


        /// <summary>
        /// Saves a record to the City table.
        /// </summary>
        public static int Insert(CityInfo cityInfo)
        {
            try
            {
                return new CityDAO().Insert(cityInfo);
            }
            catch (Exception ex)
            {
                throw;
            }

        }
        /// <summary>
        /// Saves a record to the City table.
        /// </summary>
        public static void Update(CityInfo cityInfo)
        {
            try
            {
                new CityDAO().Update(cityInfo);
            }
            catch (Exception ex)
            {
                throw;
            }

        }


	}
}
